﻿


using LaserMark.Models;
using LaserMark.DataAccess.Service;
using System.Net.Http;
using System.Net.Http.Json;

namespace LaserMark.Components.Utils;

public class ErpHttpClient
{
    private IConnectLineService ConnectLineService { get; set; }

    [NotNull]
    private HttpClient HttpClient { get; set; }

    public ErpHttpClient(HttpClient httpClient, IConnectLineService connectLineService)
    {
        HttpClient = httpClient;
        ConnectLineService = connectLineService;
        HttpClient.BaseAddress = new Uri("http://192.168.0.107:7000");
    }

    public async Task<ErpResponse<T>?> GetFromJsonAsync<T>(string url)
    {
        return await HttpClient.GetFromJsonAsync<ErpResponse<T>>(url);
    }
}
